classdef TestDotsQueryableEyeASL < TestDotsQueryableEye
    % includes TestDotsQueryableEyeASL in generic TestDotsQueryableEye
    % testing
    methods
        function self = TestDotsQueryableEyeASL(name)
            self = self@TestDotsQueryableEye(name);
            self.classname = 'dotsQueryableEyeASL';
        end
        
        function testFrameNumberRollover(self)
            qm = dotsTheQueryablesManager.theObject;
            et = qm.newObject('dotsQueryableEyeASL');
            
            maxInt = 63;
            et.frameMaxInt = maxInt;
            et.sampleFrequency = 100;
            et.initialize;
            
            % make some frame numbers that overflow at maxInt
            frameNumbers = mod(1:100, maxInt+1);
            
            % computeFrameTimes() should correct for the overflow
            localTime = 0;
            frameTimes = et.computeFrameTimes(frameNumbers, localTime);
            
            frameDiffs = diff(frameTimes);
            expectedDiffs = ones(size(frameDiffs))./et.sampleFrequency;
            assertElementsAlmostEqual(frameDiffs, expectedDiffs, ...
                'frame times should have uniform diff');
        end
    end
end